-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: eth_simulateV1
support
#10829
feat: eth_simulateV1
support
#10829
Conversation
9aa6c52
to
a45f19c
Compare
this should be possible, right @rkrasiuk reth/crates/rpc/rpc-eth-api/src/helpers/pending_block.rs Lines 407 to 417 in 026bfcc
@rkrasiuk we probably need some help navigating this API, or if this can be used with the CacheDB ? |
it is possible, all you need is to construct the reth/crates/rpc/rpc/src/debug.rs Lines 640 to 668 in e585436
one thing that's unclear to me is whether the resulting state root should include state overrides that were passed as inputs |
I think it should, given that we persist those between blocks and there might be an edge case when we can't really distinguish between slot that was just overriden and the case when it was overriden, then changed during execution and updated to the same value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this endpoint does a lot -.-
this looks pretty good, the execution logic seems right to me
there are likely a few things missing but we should try to get this in and then once we have a way to get reference data write some tests or fix things
crates/rpc/rpc-eth-api/src/core.rs
Outdated
block_number: Option<BlockId>, | ||
) -> RpcResult<Vec<SimulatedBlock>> { | ||
) -> RpcResult<Vec<SimulatedBlock<Block<WithOtherFields<reth_rpc_types::Transaction>>>>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this not return B
, because this response should include txs with additional fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our primivie -> rpc conversions return such Block
so I've just reused it
reth/crates/rpc/rpc-types-compat/src/block.rs
Lines 18 to 23 in 875cee2
pub fn from_block( | |
block: BlockWithSenders, | |
total_difficulty: U256, | |
kind: BlockTransactionsKind, | |
block_hash: Option<B256>, | |
) -> Result<Block<WithOtherFields<Transaction>>, BlockError> { |
I think this generic type should be same to the network's block response in general
ref ethereum/execution-apis#484 paradigmxyz/reth#10829 Also added hook for `eofcreate` and moved all handling away from `_env` hooks to ensure correct ordering. We don't yet insert logs for selfdestructs, would need update on revm side to pass journaled state into the hook
d0392fe
to
66ae785
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty cool.
what's still missing here? the moved precompiles? what else?
could you please add these as todos to the issue?
yeah, only moving precompiles I believe, will track |
eth_simulateV1
supporteth_simulateV1
support
…yz#196) ref ethereum/execution-apis#484 paradigmxyz/reth#10829 Also added hook for `eofcreate` and moved all handling away from `_env` hooks to ensure correct ordering. We don't yet insert logs for selfdestructs, would need update on revm side to pass journaled state into the hook
ref #8281
Adds support for
eth_simulateV1
, primary using geth implementation as reference (ethereum/go-ethereum#27720).For now it does not support moving precompiles, and does not calculate resulted block hashes correctly. Precompiles will be added later as it would be a pretty invasive change now.
And regarding block hashes, I am wondering if we have a way to calculate state root for in-memory state? would appreciate some pointers here
Marking as draft as I am still testing it and it's patched to alloy branch with small serde fixes